package cn.nami.web.db.util;

import java.util.logging.Logger;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public final class PMF
{
	private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions-optional");
	
	private static final Logger logger = Logger.getLogger(PMF.class.getName());
	
	private PMF()
	{
	}

	public static PersistenceManagerFactory get()
	{
		return pmfInstance;
	}
	
	public static void close(PersistenceManager pm)
	{
		if(pm != null)
		{
			try
			{
				// pm.close();
			}
			catch (Exception e)
			{
				e.printStackTrace();
				logger.severe("Close PersistenceManager error : " + e.getMessage());
			}
		}
	}
}